const BaseHandler     = require('../base-handler');
const HTTP_VERBS      = require('../../../constants').HTTP_VERBS;

class CreateWallHandler extends BaseHandler {

    get pattern() {
        return '/walls/create';
    }

    doGET(request, response) {
        this.Controller.getPlanInfo(request.session.user.id, (result) => {
            response.render('console/edit', {
                user: request.session.user,
                data: {
                    sources: [],
                    settings: {
                        is_auto_approve: false
                    }
                },
                tag_source: '[]',
                tag_authority: '',
                user_authority: 1,
                wall_id: '-1',
                plan: result.data
            });
        });
    }

    setup() {
        this.registerVerb(HTTP_VERBS.GET, this.doGET);
    }
}

module.exports = CreateWallHandler;